package ehsm

type ConstantMap map[string]int8

func (c ConstantMap) Get(key string) int8 {
	if v, ok := c[key]; ok {
		return v
	}
	return -1
}

var MessageTypeMap = ConstantMap{
	"EH_RAW":    1,
	"EH_DIGEST": 2,
}

// ehsm_digest_mode_t
var DigestModeMap = ConstantMap{
	"EH_SHA_224": 1,
	"EH_SHA_256": 2,
	"EH_SHA_384": 3,
	"EH_SHA_512": 4,
	"EH_SM3":     5,
}

var KeyUsageMap = ConstantMap{
	"EH_KEYUSAGE_ENCRYPT_DECRYPT": 1,
	"EH_KEYUSAGE_SIGN_VERIFY":     2,
}

var KeyOriginMap = ConstantMap{
	"EH_INTERNAL_KEY": 1,
	"EH_EXTERNAL_KEY": 2,
}

var PaddingModeMap = ConstantMap{
	"EH_PAD_NONE":       1,
	"EH_RSA_PKCS1":      2,
	"EH_RSA_PKCS1_PSS":  3,
	"EH_RSA_PKCS1_OAEP": 4,
}
var KeySpecMap = ConstantMap{
	"EH_AES_GCM_128": 1,
	"EH_AES_GCM_192": 2,
	"EH_AES_GCM_256": 3,
	"EH_RSA_2048":    10,
	"EH_RSA_3072":    11,
	"EH_RSA_4096":    12,
	"EH_EC_P224":     20,
	"EH_EC_P256":     21,
	"EH_EC_P256K":    22,
	"EH_EC_P384":     23,
	"EH_EC_P521":     24,
	"EH_SM2":         30,
	"EH_SM4_CTR":     31,
	"EH_SM4_CBC":     32,
	"EH_HMAC":        40,
}
